<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List, java.util.Map" %>

<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单管理</title>
    <!-- 引入 LayUI 样式文件 -->
    <link rel="stylesheet" type="text/css" href="../../layui-v2.9.10/layui/css/layui.css"/>
    <!-- 自定义样式 -->
    <style>
        body {
            background-color: #f5f5f5;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
        }
        .layui-nav-child{
            color: #0C0C0C;
        }
        .layui-header {
            background-color: #303030;
            color: #fff;
            padding: 0 15px;
        }
        .layui-header .layui-logo {
            font-size: 24px;
            line-height: 60px;
            margin-right: 30px;
        }

        .layui-side, .layui-layout-admin .layui-body, .layui-footer {
            background-color: #f5f5f5;
            color: #333;
        }
        .layui-card-header {
            background-color: #303030;
            color: #fff;
        }
        .layui-card-body {
            background-color: #fff;
            color: #333;
        }
        .layui-layout-admin .layui-body {
            padding: 15px;
        }
        .layui-side {
            background-color: #333; /* 背景颜色 */
            flex-shrink: 0;
        }
        .layui-side-scroll {
            height: 100%; /* 高度设为100% */
            overflow: auto;
        }
    </style>
</head>
<body>

<div class="layui-layout layui-layout-admin">

        <%--头部导航--%>
        <div class="layui-header">
            <jsp:include page="header.jsp" />
        </div>


        <div class="layui-side">
            <jsp:include page="side.jsp" />
        </div>

    <%-- 主体部分 --%>
    <div class="layui-body">
        <div class="layui-card">
            <div class="layui-card-header">订单管理</div>
            <div class="layui-card-body">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>订单ID</th>
                        <th>用户ID</th>
                        <th>收件人</th>
                        <th>收件地址</th>
                        <th>收件电话</th>
                        <th>订单备注</th>
                        <th>订单创建时间</th>
                        <th>订单状态</th>
                        <th>订单金额</th>
                    </tr>
                    </thead>
                    <tbody>
                    <%

                        List<Map<String, Object>> searchResults = (List<Map<String, Object>>) session.getAttribute("searchResults");

                        if (searchResults != null) {
                            for (Map<String, Object> order : searchResults) {
                    %>
                    <tr>
                        <td><%= order.get("order_id") %></td>
                        <td><%= order.get("user_id") %></td>
                        <td><%= order.get("recipient_name") %></td>
                        <td><%= order.get("recipient_address") %></td>
                        <td><%= order.get("recipient_phone") %></td>
                        <td><%= order.get("notes") %></td>
                        <td><%= order.get("order_date") %></td>
                        <td><%= order.get("order_status") %></td>
                        <td><%= order.get("order_total") %></td>
                    </tr>
                    <%
                        }
                    } else {
                    %>
                    <tr>
                        <td colspan="9">没有订单数据</td>
                    </tr>
                    <%
                        }
                    %>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <jsp:include page="../admin/footer.jsp" />
        © 在线商城管理系统 - 版权所有
    </div>
</div>

<!-- 引入 LayUI JavaScript 文件 -->
<script src="../../layui-v2.9.10/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element', 'layer'], function(){
        var element = layui.element;
        var layer = layui.layer;

        // 监听导航点击事件
        element.on('nav(test)', function(elem){
            layer.msg(elem.text());
        });
    });
</script>
</body>
</html>
